package com.neusoft.nepm.controller;


import com.neusoft.common.domain.Administrator;
import com.neusoft.nepm.service.AdministratorService;
import jakarta.annotation.Resource;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;



import java.util.Map;
@RestController
public class LoginController {

    @Resource
    AdministratorService administratorService;
    //登录
    @PostMapping ("/Administrator_login")
    public Map<String,Object> ALogin(@RequestBody Administrator administrator){
        String md5Hex = DigestUtils.md5DigestAsHex(administrator.getPassword().getBytes());
        administrator.setPassword(md5Hex);
        Map<String, Object> map= administratorService.login(administrator);
        return map;
    }
}
